//Color palettes
$colors: (
  "surface": #191a20,
  "primary-text": #ffffff,
  "secondary-text": #a5a9ed,
  "link-text": #a5a9ed,
);

:root {
  --sans: -apple-system, blinkmacsystemfont, "Segoe UI", roboto, oxygen, ubuntu,
    cantarell, "Open Sans", "Helvetica Neue", sans-serif;

  &[color-mode="dark"] {
    --surface: #191a20;
    --primary-text: #ffffff;
    --secondary-text: #a5a9ed;
    --link-text: #a5a9ed;
  }

  &[color-mode="light"] {
    --surface: #f5f5f5;
    --primary-text: #212121;
    --secondary-text: #1976d2;
    --link-text: #212121;
  }
}

@mixin color-var($property, $color) {
  #{$property}: map-get($colors, "#{$color}");
  #{$property}: var(--#{$color}, map-get($colors, "#{$color}"));
}
//General Styling
*,
*:before,
*:after {
  box-sizing: border-box;
}

body,
html {
  margin: 0;
  height: 100%;
  font-size: 1rem;
  line-height: 1.4rem;
  font-family: var(--sans);
  @include color-var(background-color, surface);
  @include color-var(color, primary-text);
}

p,
blockquote,
li {
  text-align: justify;
  line-height: 1.6rem;
}

blockquote {
  position: relative;
  padding: 2rem 0;
  width: 100%;
  margin: 40px auto;
  border-top: solid 3px;
  border-bottom: solid 3px;
  font-size: 1.2rem;
  font-style: italic;
  line-height: 1.8rem;
  @include color-var(border-color, secondary-text);
}

blockquote:after {
  position: absolute;
  content: "”";
  @include color-var(color, secondary-text);
  font-size: 8rem;
  bottom: -40px;
  right: 10px;
}

a,
a:link,
a:visited {
  @include color-var(color, link-text);
}

//Toggle related styles
form {
  .description {
    text-align: center;
    margin-bottom: 1rem;
  }
  .switch {
    position: relative;
    width: 18rem;
    height: 3rem;
    margin: 0 auto;
    font-size: 0;

    input {
      position: absolute;
      top: 0;
      z-index: 2;
      opacity: 0;
      cursor: pointer;
      height: 3rem;
      width: 6rem;
      left: 6rem;
      margin: 0;

      &:checked {
        z-index: 1;

        ~ .toggle-outside .toggle-inside {
          left: 0.25rem;
        }

        + label {
          opacity: 1;
          cursor: default;
        }
      }

      &:not(:checked) + label:hover {
        opacity: 0.5;
      }
    }

    label {
      @include color-var(color, primary-text);
      opacity: 0.33;
      transition: opacity 0.25s ease;
      cursor: pointer;
      font-size: 1rem;
      line-height: 3rem;
      display: inline-block;
      width: 6rem;
      height: 100%;
      margin: 0;
      text-align: center;

      &:last-of-type {
        margin-left: 6rem;
      }
    }

    .toggle-outside {
      height: 100%;
      border-radius: 2rem;
      padding: 0.25rem;
      overflow: hidden;
      transition: 0.5s ease all;
      background: #fff;
      position: absolute;
      width: 6rem;
      left: 6rem;
      box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.1);
    }

    .toggle-inside {
      border-radius: 5rem;
      background: #192432;
      position: absolute;
      transition: 0.25s ease all;
      height: 2.5rem;
      width: 2.5rem;

      &:before {
        font-family: "Font Awesome 5 Free";
        font-size: 1rem;
        font-weight: 900;
        content: "\f186";
        font-style: normal;
        color: #ffffff;
        font-variant: normal;
        text-rendering: auto;
        -webkit-font-smoothing: antialiased;
        display: inline-block;
        position: absolute;
        z-index: 3;
        margin: 20% auto;
        left: 0;
        right: 0;
        text-align: center;
        color: #b2ebf2;
      }
    }

    input ~ input:checked ~ .toggle-outside .toggle-inside {
      left: 3.25rem;
      background-color: #fbc02d;

      &:before {
        content: "\f185";
        color: #ff5722;
      }
    }

    input#on:focus ~ .toggle-outside .toggle-inside {
      background-color: #b2ebf2;

      &:before {
        color: #192432;
      }
    }

    input#off:focus ~ .toggle-outside .toggle-inside {
      background-color: #ff5722;

      &:before {
        color: #fbc02d;
      }
    }
  }
}

//Grid and example layout styles
.wrapper {
  margin: 0 auto;
  padding: 1.2rem;
  display: grid;
  justify-content: start;
  align-content: start;
  gap: 0 30px;
  grid-template-areas:
    "widgets"
    "header"
    "content"
    "sidebar"
    "footer";

  .main-head {
    grid-area: header;
    font-size: 1.2rem;
    padding: 1rem 0;
    @include color-var(color, secondary-text);

    h1 {
      border-bottom: 3px solid;
      @include color-var(border-color, secondary-text);
      line-height: 3.5rem;
      padding-bottom: 1rem;
    }
  }

  .head-widgets {
    grid-area: widgets;
    padding: 1rem 0;
  }

  .content {
    grid-area: content;
    padding-bottom: 2rem;
  }

  .side {
    grid-area: sidebar;

    p {
      text-align: left;
    }
  }

  .main-footer {
    grid-area: footer;
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid;
    @include color-var(border-color, primary-text);
    font-size: 0.9rem;
  }

  // Large devices (desktops, 992px and up)
  @media (min-width: 992px) {
    max-width: 920px;
    grid-template-columns: 8fr 4fr;
    grid-template-areas:
      "header widgets"
      "content sidebar"
      "footer footer";
  }
}
